﻿using System;
using System.Collections.Generic;

using E.BLL;
using E.Model;
using E.Web.UI.Page;

using X.Pager;
using X.Pager.List;
using X.Common;

namespace E.Web.Teacher.internals.statistics
{
    public partial class Course : TeacherBasePage
    {
        public IList<ClassUserCountModel> dataList = new List<ClassUserCountModel>();
        public Dictionary<int, string> courseList;
        public string act;
        public string classCode;
        public int courseid;

        protected override void ShowPage()
        {
            courseList = (new CourseBLL()).GetInternalCourseList();

            act = XRequest.GetString("act");

            if (ispost || act == "s")
            {
                classCode = XRequest.GetString("ClassCodeTxt");
                courseid = XRequest.GetInt("CourseSlt", -1);

                CourseAnalysisSearchModel searchModel = new CourseAnalysisSearchModel();
                searchModel.TeacherID = authority == E.Enum.EnumTeacherAuthority.Admin ? -1 : teacherid;
                searchModel.CourseID = courseid;
                searchModel.ClassCode = classCode;

                ClassUserCountListModel listModel = new ClassUserCountListModel();

                CheckPageIndexValue(XRequest.GetInt("s", 1) - 1, XRequest.GetInt("g", 0), XRequest.GetInt("z", customerPageSize));
                listModel = (new SurveyBLL()).GetInternalClassUserCountList(searchModel, customerPageSize, pageIndex);
                if (listModel.TotalCount > 0)
                {
                    count = listModel.TotalCount;
                    dataList = listModel.List;
                    PagerBase pager = new ListPager(count, pageIndex, currentPgGroup, customerPageSize, defaultPagesInGroup);

                    Dictionary<string, string> parms = new Dictionary<string, string>();
                    parms.Add("act", act);
                    parms.Add("ClassCodeTxt", classCode);
                    parms.Add("CourseSlt", courseid.ToString());
                    mypager = pager.DrawPager("selfpager", parms);
                }

            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}
